//对所有的api接口进行统一的管理
import requests from "./request"
import mockRequests from './mockAjax'
//三级接口联动
export const reqCategoryList = () => {
        return requests({
            url: "/product/getBaseCategoryList"
        })
    }
    //获取banner数据
export const reqGetBannerList = () => {
        return mockRequests({
            url: "/banner"
        })
    }
    //获取floor组件的数组
export const reqGetFloorList = () => {
        return mockRequests({
            url: "/floor"
        })
    }
    // 获取search组件的数据
export const reqGetSearchList = (params) => {
        return requests({
            url: '/list',
            method: "post",
            data: params
        })
    }
    //获取detail详情数据
export const reqGetDetailList = (skuId) => {
        return requests({
            url: `/item/${skuId}`,
        })
    }
    // 发起购物车请求
export const reqCartPost = (skuId, skuNum) => {
        return requests({
            url: `/cart/addToCart/${skuId}/${skuNum}`,
            method: "POST"
        })
    }
    // 获取购物车列表
export const reqGetCartList = () => {
        return requests({
            url: "/cart/cartList"
        })
    }
    // 删除请求
export const reqDeleteCart = (skuId) => {
        return requests({
            url: `/cart/deleteCart/${skuId}`,
            method: "delete"
        })
    }
    // 商品选中状态请求
export const reqCheckState = (skuId, isChecked) => {
        return requests({
            url: `/cart/checkCart/${skuId}/${isChecked}`
        })
    }
    // 登录注册请求
export const reqGetCode = (phone) => {
    return requests({
        url: `/user/passport/sendCode/${phone}`
    })
}
export const reqRegister = (data) => {
    return requests({
        url: `/user/passport/register`,
        method: "post",
        data
    })
}
export const reqLogin = (data) => {
    return requests({
        url: `/user/passport/login`,
        method: "post",
        data
    })
}
export const reqGetUserInfo = () => {
    return requests({
        url: `/user/passport/auth/getUserInfo`,
    })
}
export const reqLayout = () => {
        return requests({
            url: `/user/passport/logout`,
        })
    }
    //获取地址信息
export const reqGetAddress = () => {
        return requests({
            url: `/user/userAddress/auth/findUserAddressList`,
        })
    }
    // 获取商品清单/order/auth/trade
export const reqGetTradeList = () => {
        return requests({
            url: `/order/auth/trade`,
        })
    }
    //提交商品订单/order/auth/submitOrder?tradeNo={tradeNo}
export const reqSubmit = (tradeNo, data) => {
        return requests({
            url: `/order/auth/submitOrder?tradeNo=${tradeNo}`,
            data,
            method: 'post'
        })
    }
    //获取订单信息
export const reqOrderList = (orderId) => {
        return requests({
            url: `/payment/weixin/createNative/${orderId}`
        })
    }
    //获取支付状态
export const reqPaymentState = (orderId) => {
        return requests({
            url: `/payment/weixin/queryPayStatus/${orderId}`
        })
    }
    // 获取我的订单
export const reqMyOrder = (page, limit) => {
    return requests({
        url: `/order/auth/${page}/${limit}`
    })
}